<?php

namespace Kateba\RestaurantBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * Kateba\RestaurantBundle\Entity\Category
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Kateba\RestaurantBundle\Entity\CategoryRepository")
 */
class Category {

    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var Kateba\RestaurantBundle\Entity\Category $parent
     * 
     * @ORM\OneToOne(targetEntity="Category")
     * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
     */
    private $parent;

    /**
     * @var Doctrine\Common\Collections\ArrayCollection $food
     * 
     * @ORM\OneToMany(targetEntity="Kateba\RestaurantBundle\Entity\Food", mappedBy="category", cascade={"all"}, orphanRemoval=true)
     */
    private $food;

    /**
     * @var Doctrine\Common\Collections\ArrayCollection $extraPrice
     * 
     * @ORM\OneToMany(targetEntity="Kateba\RestaurantBundle\Entity\ExtraPrice", mappedBy="category", cascade={"all"}, orphanRemoval=true)
     */
    private $extras;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name) {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName() {
        return $this->name;
    }

    public function __construct() {
        $this->food = new \Doctrine\Common\Collections\ArrayCollection();
        $this->extras = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Set parent
     *
     * @param Kateba\RestaurantBundle\Entity\Category $parent
     */
    public function setParent(\Kateba\RestaurantBundle\Entity\Category $parent) {
        $this->parent = $parent;
    }

    /**
     * Get parent
     *
     * @return Kateba\RestaurantBundle\Entity\Category 
     */
    public function getParent() {
        return $this->parent;
    }

    /**
     * Add food
     *
     * @param Kateba\RestaurantBundle\Entity\Food $food
     */
    public function addFood(\Kateba\RestaurantBundle\Entity\Food $food) {
        $this->food[] = $food;
    }

    /**
     * Get food
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getFood() {
        return $this->food;
    }

    /**
     * Add extras
     *
     * @param Kateba\RestaurantBundle\Entity\ExtraPrice $extras
     */
    public function addExtraPrice(\Kateba\RestaurantBundle\Entity\ExtraPrice $extras) {
        $this->extras[] = $extras;
    }

    /**
     * Get extras
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getExtras() {
        return $this->extras;
    }

}